import request from "@/utils/request";
import { DepartTypeQuery, DepartTypePageResult, DepartTypeForm, DepartType } from "./model";

/**
 * 板块分类API
 */
class DepartTypeAPI {

  /**
   * 板块内容分类分页数据
   * @param queryParams 
   * @returns 
   */
  static getPage(queryParams?: DepartTypeQuery) {
    return request<any, DepartTypePageResult>({
      url:
        "/departType/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 获取板块分类列表
   * @param data 
   * @returns 
   */
  static getList(data: DepartTypeQuery) {
    return request<any, DepartType[]>({
      url: "/departType/getList",
      method: "post",
      data: data,
    });
  }


  /**
   * 新增板块分类
   * @param data 
   * @returns 
   */
  static add(data: DepartTypeForm) {
    return request({
      url: "/departType/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改板块分类
   * @param data 
   * @returns 
   */
  static update(data: DepartTypeForm) {
    return request({
      url: "/departType/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除板块分类
   * @param data 
   * @returns 
   */
  static delete(data: DepartTypeForm) {
    return request({
      url: "/departType/delete",
      method: "post",
      data: data,
    });
  }
}

export default DepartTypeAPI;
